package com.hh.designPrinciples.OpenigClosing;


/**
 * @author huangh
 * @since 2019/11/12
 * @deprecated 开闭原则
 */
public class Test {
    public static void main(String[] args) {
        JavaCourse javaCourse = new JavaCourse(96, "设计模式", 389d);
        System.out.println("ID:" + javaCourse.getId() +
                "，课程名称：" + javaCourse.getName() +
                "，价格：" + javaCourse.getPrice());
        /**
         需求：双11到了，搞活动，打8折
         则在原有基础上不变，对外扩展
         创建 JavaDiscountCourse 类 继承 JavaCourse 类 实现 打折
         */
        ICourse iCourse = new JavaDiscountCourse(91,"打折商品",389d);
        JavaDiscountCourse javaDiscountCourse = (JavaDiscountCourse) iCourse;
        System.out.println("ID:" + javaDiscountCourse.getId() +
                "，课程名称：" + javaDiscountCourse.getName() +
                "，价格：" + javaDiscountCourse.getPrice() +
                    ", 原价：" + javaDiscountCourse.getOriginPrice()
        );
    }
}
